#pragma once

#include <string>
#include "ClientMgr.h"

class CDataProc
{
public:
    CDataProc(ClntNode *pNode);
    ~CDataProc();

public:
    bool DataHandle(const uint8_t *const pData, uint16_t nLen);

private:
    bool FileUploadRequest(const uint8_t *pData, uint16_t nLen);
    bool AddUploaderRequest(const uint8_t *pData, uint16_t nLen);
    bool GetFileInfoRequest(const uint8_t *pData, uint16_t nLen);
    bool GetFileInfoResponse(const uint8_t *pData, uint16_t nLen);
    bool FileBlockRequest(const uint8_t *pData, uint16_t nLen);
    bool FileDataRequest(const uint8_t *pData, uint16_t nLen);
    bool TransferFinish(const uint8_t *pData, uint16_t nLen);

private:
    ClntNode *const m_pClntNode;
    std::string m_strFile;
    int64_t m_iFileLen;
    int m_fd;
    uint8_t *m_pBlockData;
    uint32_t m_nBlockLen;
    uint32_t m_nCurLen;
};
